local limu = fk.CreateSkill{
    name = "heg__limu",
}

Fk:loadTranslationTable{
  ["heg__limu"] = "立牧",
  [":heg__limu"] = "出牌阶段限一次，你可以将一张<font color='red'>♦</font>牌当【乐不思蜀】对自己使用，然后回复1点体力，本回合出牌阶段使用【杀】的限制次数额外增加此牌点数。",

  ["#heg__limu"] = "立牧：将一张<font color='red'>♦</font>牌当【乐不思蜀】对自己使用，然后回复1点体力",
  ["@heg__limu-phase"] = "立牧",

  ["$heg__limu1"] = "米贼作乱，吾必为益州自保。",
  ["$heg__limu2"] = "废史立牧，可得一方安定。",
}

limu:addEffect("active", {
  anim_type = "control",
  prompt = "#heg__limu",
  card_num = 1,
  target_num = 0,
  can_use = function(self, player)
    return not player:hasDelayedTrick("indulgence") and not table.contains(player.sealedSlots, Player.JudgeSlot)
  end,
  target_filter = Util.FalseFunc,
  card_filter = function(self, player, to_select, selected)
    if #selected == 0 and Fk:getCardById(to_select).suit == Card.Diamond then
      local card = Fk:cloneCard("indulgence")
      card:addSubcard(to_select)
      return not player:prohibitUse(card) and not player:isProhibited(player, card)
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    room:useVirtualCard("indulgence", effect.cards, player, player, limu.name)
    if player:isWounded() and not player.dead then
      room:recover{
        who = player,
        num = 1,
        skillName = limu.name,
      }
    end
    room:setPlayerMark(player, "@heg__limu-phase", Fk:getCardById(effect.cards[1]).number)
  end,
})

limu:addEffect("targetmod", {
    residue_func = function(self, player, skill, scope)
    if skill.trueName == "slash_skill" and scope == Player.HistoryPhase then
        return player:getMark("@heg__limu-phase")
      end
    end,
})

return limu